﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using Zero.Service;
using System.Net;
using System.Net.Http;

namespace Zero.Web.API.Controllers
{
    public class AccountController : ApiController
    {
        private readonly ISystemService systemService;
        public AccountController(ISystemService systemService)
        {
            this.systemService = systemService;
        }
        
        //
        // GET: /Account/
        
        public HttpResponseMessage Get()
        {
            //return "Value";
            return Request.CreateResponse(HttpStatusCode.OK, ValidateLogin());
            
        }
        public bool ValidateLogin()
        {
            var context = System.Web.HttpContext.Current;
            string username = context.Request.Params["username"];
            string password = context.Request.Params["password"];
            
            return systemService.UserLogin(username, password) ? true : false;
        }
        //
       
    }
}
